package com.lightboat.system.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.DateDeserializers;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.lightboat.common.annotation.Excel;
import com.lightboat.common.core.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.SchemaProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 用户跟进关系对象 crm_user_follow_relation
 * 
 * @author lightboat
 * @date 2025-08-22
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Schema(title = "用户跟进关系")
@TableName(value = "crm_user_follow_relation", autoResultMap = true)
public class CrmUserFollowRelation extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** 主键ID */
    @Schema(title = "主键ID")
    @TableId
    private Long id;

    /** 用户ID */
    @Schema(title = "用户ID")
    @Excel(name = "用户ID")
    private Long userId;

    /** 部门ID */
    @Schema(title = "部门编号")
    @TableField(fill = FieldFill.INSERT)
    @Excel(name = "部门编号", type = Excel.Type.IMPORT)
    private Long deptId;

    /** 客户ID */
    @Schema(title = "客户ID")
    @Excel(name = "客户ID")
    private Long customerId;

    /** 订单ID */
    @SchemaProperty(name = "订单ID")
    @Excel(name = "订单ID")
    private Long orderId;

    /** 外部订单ID */
    @SchemaProperty(name = "外部订单ID")
    @Excel(name = "外部订单ID")
    private String externalOrderId;

    /** 最后跟进时间 */
    @SchemaProperty(name = "最后跟进时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonDeserialize(using = DateDeserializers.DateDeserializer.class)
    @JsonSerialize(using = DateSerializer.class)
    @Excel(name = "最后跟进时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date contactLastTime;

    /** 最后跟进内容 */
    @SchemaProperty(name = "最后跟进内容")
    @Excel(name = "最后跟进内容")
    private String contactLastContent;

    /** 下次联系时间 */
    @SchemaProperty(name = "下次联系时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonDeserialize(using = DateDeserializers.DateDeserializer.class)
    @JsonSerialize(using = DateSerializer.class)
    @Excel(name = "下次联系时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date contactNextTime;

    /** 跟进状态 */
    @SchemaProperty(name = "跟进状态")
    @Excel(name = "跟进状态")
    private Integer followUpStatus;


    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("userId", getUserId())
            .append("customerId", getCustomerId())
            .append("orderId", getOrderId())
            .append("externalOrderId", getExternalOrderId())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .toString();
    }
}
